package com.tangruojie.stream;

import com.tangruojie.entity.Author;

import java.util.List;

/**
 * 中间操作之 sorted 排序
 */
public class StreamDemo05 {

    public static void main(String[] args) {

        List<Author> authors = StreamDemoTest.getAuthors();

        /**
         * 降序排序
         */
        authors.stream()
                .distinct()
                .sorted((author1, author2) -> author2.getAge() - author1.getAge())
                .forEach(author -> System.out.println(author.getAge()));

    }

}
